<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>免费高清福利图</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale = 1.0,user-scalable=no"/>
    <meta name="Keywords" content=""/>
    <meta name="Description" content=""/>
    <link rel="stylesheet" href="/style/reset.css"/>
    <link rel="stylesheet" href="/style/common.css">
    <link rel="stylesheet" href="/style/swiper.min.css">

    <script src="/js/swiper.min.js"></script>

    <script src="/js/jquery-3.2.1.min.js"></script>

    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>

</head>
<script>
    (function (doc, win) {
        var docEl = doc.documentElement,
                resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                recalc = function () {
                    var clientWidth = docEl.clientWidth;
                    if (!clientWidth) return;
                    docEl.style.fontSize = 10 * (clientWidth / 375) + 'px';
                };

        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);
</script>
<body>
<div class="wrap">
    <!-- 弹框 -->
    <div class="tk-zz" style="display:none"></div>
    <div class="tk-box" style="display:none">
        <div class="tk-box-1">
            <p>邀请好友加入，注册各得6666金币！</p>
            <ul>
                <li>1、通过邀请页或写真页分享邀请内容给好友；</li>
                <li>2、好友填写领取手机并下载客户端登录；</li>
                <li>3、你与好友各得6666金币；</li>
                <li class="mgtop10">其它说明</li>
                <li>1、邀请人每天最多可得10份奖励；</li>
                <li>2、好友奖励不受限制；</li>
            </ul>
            <a href="#" class="btn">朕知道了</a>
        </div>
    </div>
    <div class="banner">
        <!-- Swiper -->
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide"><img src="" alt=""></div>
                <div class="swiper-slide"><img src="" alt=""></div>
                <div class="swiper-slide"><img src="" alt=""></div>
                <div class="swiper-slide"><img src="" alt=""></div>
                <div class="swiper-slide"><img src="" alt=""></div>
            </div>
        </div>
    </div>
    <!-- Add Pagination -->
    <div class="swiper-pagination-box">
        <div class="swiper-pagination"></div>
    </div>
    <div class="box">
        <dl class="box-dl">
            <dt>

            </dt>
            <dd>
                <sapn id="title">来自 <span id="nick"></span> 的福利\(^o^)/~全套高清大图，你懂得</sapn>
                <sapn id="title1" style='display:none;'><span id="nick"></span>：下载注册→你得福利→我得奖励(>^ω^<)</sapn>
            </dd>
        </dl>
        <br>
        <div style='display:none;' id="div2">
            <!-- 奖励已放入账户 -->
            <p class="awa-box"> 奖励已放入帐户： <span id="tel"></span><a href="javascript:void(0);"
                                                                  onclick="editPhone()">修改></a></p>
        </div>


        <!-- end -->
        <!-- 搜索框 -->
        <div class="ss-box" style='display:block;' id="div1">

            <!-- 提示无效手机 -->
            <span class="wx-phone">无效的手机号，请重新输入</span>
            <!-- end -->
            <input type="number" id="phone" name="phone" placeholder="输入手机号领取全套图集"
                   onkeyup="this.value=this.value.replace(/[^0-9]/g,'')"
                   onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')">
            <a href="javascript:void(0);" onclick="phonesubmit()">领取图集</a>
        </div>
        <!-- end -->
        <!-- 下载app -->
        <a href="/download/guoguo.apk" class="app-btn">下载App欣赏套图（7.9M） <span></span></a>
        <!-- end -->
    </div>
</div>
<!-- Swiper JS -->


<!-- Initialize Swiper -->


<script type="text/javascript">
    $(".app-btn").hide();
    $(".wx-phone").hide();


    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        paginationBulletRender: function (swiper, index, className) {
            return '<span class="' + className + '">' + (index + 1) + '</span>';
        }
    });


    var token = "";

    /** 获取参数 **/
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null)return unescape(r[2]);
        return null;
    }

    /**获取token**/
    function fill_token() {
        $.ajax({
            type: "POST",
            url: "http://api.lyoucity.com/api/guestLogin",
            data: {
                Mac: returnCitySN["cip"]
            },
            success: function (data) {
                token = data.data.token;
                if (null != token) {
                    findUser(token);
                    fill_Img(token);
                }
            }
        });

    }

    /**获取图片**/
    function fill_Img(token) {
        $.ajax({
            type: "POST",
            url: "http://api.lyoucity.com/api/category/getAlbumImageList",
            data: {
                albId: GetQueryString("albId"),
                pageNum: 1,
                pageSize: 5
            },
            beforeSend: function (request) {
                request.setRequestHeader("token", token);
            },
            success: function (data) {
                if (null != data.data.list) {
                    $('.swiper-wrapper').empty();
                    for (var i = 0; i < data.data.list.length; i++) {
                        var htmlStr = "<div class=\"swiper-slide\"><img src=\"" + data.data.list[i].originalUrl + "\" alt=\"\"></div>";
                        $('.swiper-wrapper').append(htmlStr);
                    }
                }
            }
        });

    }
    /*** 用户头像 **/
    function findUser(token) {

        $.ajax({
            type: "POST",
            url: "http://api.lyoucity.com/api/user/findUser",
            data: {
                userId: GetQueryString("userId")
            },
            beforeSend: function (request) {
                request.setRequestHeader("token", token);
            },
            success: function (data) {
                var nicks = $("[id=nick]");
                $.each(nicks, function (index) {
                    $(nicks[index]).html(data.data.nickname).css("color", "red");
                })
                if (null != data && null != data.data.icon) {
                    $(".box-dl dt").css("background", "url('" + data.data.icon + "') no-repeat")
                            .css("-webkit-background-size", "cover").css("-moz-background-size", "cover")
                            .css("background-size", "cover");

                }
            }
        });
    }

    $(document).ready(function () {
        fill_token();
    });

    function editPhone() {
        $("#div1").show();
        $("#div2").hide();
        $("#tel").html();
        $('#phone').val('');
        $('#title').show();
        $('#title1').hide();
        $('.app-btn').hide();

    }

    function phonesubmit() {

        var mobile = $('#phone').val();
        if (mobile.length == 0) {
            //alert('请输入手机号码！');
            $("#phone").val("");
            $("#phone").focus();
            $("#phone").attr("placeholder", "请输入手机号");
            $(".wx-phone").text("手机号不能为空");
            $(".wx-phone").fadeIn();
            return false;
        }
        if (mobile.length != 11) {
            // alert('请输入有效的手机号码！');
            $("#phone").val("");
            $("#phone").focus();
            $("#phone").attr("placeholder", "请输入有效的手机号码！");
            /*$(".infoerr").text("无效的手机号，请重新输入");*/
            $(".wx-phone").text("无效的手机号，请重新输入");
            $(".wx-phone").fadeIn();
            return false;
        }
        if (mobile.length == 11) {
            // alert('请输入有效的手机号码！');
            $(".app-btn").show();
            $(".ss-box").hide();
        }
        var data = {
            phone: $('#phone').val(),
            userId: GetQueryString("userId"),
        }


        $.ajax({
            url: "http://api.lyoucity.com/api/invite/addInvite",
            type: "post",
            dataType: "text",
            data: data,
            beforeSend: function (request) {
                request.setRequestHeader("token", token);
            },
            success: function (data) {
                $("#tel").html($('#phone').val());
                $("#div2").show();
                $("#div1").hide();
                $('#title').hide();
                $('#title1').show();


            },
        })


    }
</script>
<style>
    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none !important;
        margin: 0;
    }
</style>
<div style="display:none">
    <script src="https://s22.cnzz.com/z_stat.php?id=1266997414&web_id=1266997414" language="JavaScript"></script>
</div>
</body>

</html>